An Eades-McKay Algorithm for Well-Formed Parentheses Strings

نویسندگان

  • Bette Bultena
  • Frank Ruskey
چکیده

Let T(n) be the set of all well-formed parentheses strings of length 2n. We show that the elements of T(n) can be listed so that successive strings diier by the transposition of a left and a right parenthesis. Furthermore, between the two parentheses that are transposed, only left parentheses occur. Our listing is a modiication of the well-known Eades-McKay 4] algorithm for generating combinations. Like that algorithm, ours generates strings from the lexico-graphically greatest string to the lexicographically least and can be implemented so that each string is generated in constant time, in an amortized sense.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Combinatorial Generation by Fusing Loopless Algorithms

Some combinatorial generation problems can be broken into subproblems for which loopless algorithms already exist. We discuss means by which loopless algorithms can be fused to produce a new loopless algorithm that solves the original problem. We demonstrate this method with two new loopless algorithms, MIXPAR and MULTPERM. MIXPAR generates well-formed parenthesis strings containing two differe...

متن کامل

Topologically Distinct Sets of Non-intersecting Circles in the Plane

Nested parentheses are forms in an algebra which define orders of evaluations. A class of well-formed sets of associated opening and closing parentheses is well studied in conjunction with Dyck paths and Catalan numbers. Nested parentheses also represent cuts through circles on a line. These become topologies of non-intersecting circles in the plane if the underlying algebra is commutative. Thi...

متن کامل

Some Parallel Algorithms Based on Parentheses Matching on Linear Arrays with Optical Buses

The parentheses matching problem is to determine the index of the mate for each parenthesis, and plays an important role in the design of parallel algorithms. In this paper, we consider two problems: reconstructing an original binary from encoded bit strings and transforming an infix expression into a postfix one. This paper proposes optimal parallel algorithms for these problems based on paren...

متن کامل

The Encoding of Natural Numbers as Nested Parentheses Strings with Associated Probability Distributions

We provide an efficient encoding of the natural numbers {0,1,2,3,...} as strings of nested parentheses {(),(()),(()()),((())),...}, or considered inversely, an efficient enumeration of such strings. The technique is based on the recursive definition of the Catalan numbers. The probability distributions arising from this encoding are explored. Applications of this encoding to prefix-free data en...

متن کامل

Generating Balanced Parentheses and Binary Trees by Prefix Shifts

We show that the set Bn of balanced parenthesis strings with n left and n right parentheses can be generated by prefix shifts. If b1, b2, . . . , b2n is a member of Bn, then the k-th prefix shift is the string b1, bk, b2, . . . , bk−1, bk+1, . . . , b2n. Prefix shift algorithms are also known for combinations, and permutations of a multiset; the combination algorithm appears in fascicles of Knu...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:
  • Inf. Process. Lett.

دوره 68  شماره 

صفحات  -

تاریخ انتشار 1998